home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-04-04 | 1.2 KB | 43 lines | [TEXT/PJMM] |
- { HyperCard SetTimeDate XCMD }
- { by Dave Kelly }
-
- unit SetTimeDateUnit; { This project handles the SetTimeDate command }
- interface
- uses { include the HyperCard interfaces in the XFCN/CMD }
- HyperXCmd;
-
- procedure main (paramPtr: XCmdPtr); { the entry point for the XCMD/XFCN }
-
- implementation
-
- procedure main;
-
- procedure Fail (errMsg: Str255); { return a given error message to HyperCard }
- begin
- paramPtr^.returnValue := PasToZero(paramPtr, errMsg);
- {Set the return value of the paramBlock to the given message. }
- exit(main); {exit the routine }
- end;
-
- procedure Setthetime (paramPtr: XCmdPtr);
- var
- str: str255;
- TheTimeDate: longint;
- Error: OSErr;
-
- begin
- if (paramPtr^.paramCount <> 1) then
- Fail('%bad parameters');
-
- ZeroToPas(paramPtr, paramPtr^.params[1]^, str); { convert the location to a string }
- TheTimeDate := StrToNum(paramPtr, str); { and thence to a longint }
- Error := SetDateTime(TheTimeDate);
- { if the handle is empty, then return an error}
- if Error <> noErr then
- Fail('DateTime not changed!');
- end;
-
- begin
- Setthetime(paramPtr); {entry point; call the Setthetime routine}
- end;
- end.